#include"graphics.h"

//*************************************棋盘重现

extern WINDOW* g_win;
extern GRAPHICS_COLOR g_fore_color;
extern GRAPHICS_COLOR g_back_color;
extern int g_style;

extern int count;
extern POINT* head;

void ChessDisplay()
{
		clear_screen(0,0,COLS,LINES);	        	     //清屏
		drawChessboard();				                 //画棋盘

					
		POINT* tmp;
	
		g_back_color = GCWhite;
		wattrset(g_win,CURRENT_ATTRIBUTE);	             //更新前景色和背景色
		char* p1 = "                                                                           ";
		mvaddstr(2,0,p1);		                         //清除上面的提示
        int i=0;
        char* p[] = {"1.按ESC  返回主菜单 ","2.按SPACE上局棋重现" };
        //clear_screen(10,75,COLS,LINES);	     	     //COLS，LINES是库函数中的宏
	    for(i=0; i<2; i++)
	    {
		   mvaddstr(10+i,75,p[i]);
	    }
		wrefresh(g_win);				                //刷新窗口，显示窗口的最新变化
		
		
	
		int j = 1;
		while(j<=count+1)
		{
			int ch = readkey();
			int r;
			r=count;
			switch(ch)
			{

				case 32:
					for(tmp=head,i=0; i<count-j; tmp=tmp->next,i++);	//使tmp指向链
					
					count = j;
					drawChess(tmp);			        	//画棋子
					wrefresh(g_win);			    	//刷新窗口，显示窗口的最新变化
					
					j++;
					break;
				case 27:
					count=r;
					return;
			
			}
			count=r;
		}		

}